<template>
  <div>
    <div v-for="(item, index) in arr" :key="index">
      <input type="checkbox" v-model="newarr" :value="item" />
      <span>{{ item }}</span>
    </div>
    <p>你选中的值为：{{ fn }}</p>
  </div>
</template>

<script>
export default {
  components: {},
  props: {},
  data() {
    return {
      arr: [9, 15, 19, 25, 29, 31, 48, 57, 62, 79, 87],
      newarr: [],
    };
  },
  computed: {
    fn() {
      return this.newarr.reduce((sum, val) => {
        return (sum += val);
      }, 0);
    },
  },
  watch: {},
  created() {},
  methods: {},
};
</script>

<style scoped></style>
